<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use OkStuff\PhpNsq\PhpNsq;

/**
 * nsq消息中间件 发布
 *
 * @param
 * @author liangl
 */
class PubController extends Controller
{
    /**
     * 发布消息到nsq
     *
     * @param Request $request
     * @return void
     * @param
     * @author liangl
     */
    public function pubToMq(Request $request)
    {
        $nsqConf = config('phpnsq');
        $nsqObj  = new PhpNsq($nsqConf);

        $msg = $phpnsq->setTopic("sample_topic")->publish("Hello nsq.");

        //return $this->success([]);
        echo 'done'; exit;
    }
}
